﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Jxym.wlkc2011.Module.CMS.MODEL;
using Jxym.DBUtility;

namespace Jxym.wlkc2011.WebSite
{
    public partial class Site2 : System.Web.UI.MasterPage
    {
        private string banner = "";
        private string foot = "";
        private string top = "";
        private string _TitleHtml = "";
        public string TitleHtml
        {
            get { return _TitleHtml; }
            set { _TitleHtml = value; }
        }
        public string Top { get { return top; } set { top = value; } }
        public string Foot { get { return foot; } set { foot = value; } }
        public string Banner { get { return banner; } set { banner = value; } }
        public string siteName { get; set; }
        public string tempName { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params["siteName"] != null)
            {
                siteName = Request.Params["siteName"];

                if (siteName.Equals("default"))
                {
                    xyhd1.Visible = true;
                    pt.Visible = false;
                }
                else
                {
                    xyhd1.Visible = false;
                    pt.Visible = true;
                }

                MsSqlDal<Cms_Site> site = new MsSqlDal<Cms_Site>();

                Cms_Site Info = site.GetModel("Name='" + siteName + "'", null);

                if (Info != null)
                {
                    _TitleHtml = Info.Title + " - 东北农业大学继续教育中心网络课程";

                    templateLink.Href = "Module/CMS/resources/templates/" + Info.TemplateName + "/css.css";

                    ///网站关键字
                    HtmlMeta keywords = new HtmlMeta();
                    keywords.Name = "keywords";
                    keywords.Content = Info.Keyword;
                    Page.Header.Controls.Add(keywords);
                    ///网站描述
                    HtmlMeta description = new HtmlMeta();
                    description.Name = "description";
                    description.Content = Info.Description;
                    Page.Header.Controls.Add(description);
                    ///顶部信息
                    this.top = Info.TopInfo;
                    ///banner
                    this.banner = Module.CMS.Public.cmsPublic.ViewContentByFileType(siteName, Info.Banner, "1003px", "198px", true);
                    ///版权信息
                    this.foot = Info.FootInfo;
                }
            }
        }
    }
}